﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LotteCinema.BUS;
using LotteCinema.DAO;
using LotteCinema.DTO;


namespace LotteCinema.Admin
{
    public partial class DangNhap : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        
        protected void DangNhap_Click(object sender, EventArgs e)
        {
            CDangNhap cdn = new CDangNhap();
            cdn._tenDangNhap = txtTenDangNhap.Text;
            cdn._matKhau = txtMatKhau.Text;
            try
            {
                DataTable dt = BDangNhap.dq.KiemTraDangNhap(cdn);
                if (dt.Rows.Count>=1 )
                {
                    Session["TENDANGNHAP"] = txtTenDangNhap.Text;
                    Session["MATKHAU"] = txtMatKhau.Text;//
                    Session["QUYEN"] = dt.Rows[0]["QUYEN"].ToString();
                    //if (int.Parse(Session["QUYEN"].ToString()) != 1)
                    //     Response.Redirect("~/TrangChu.aspx");
                    //else
                    WebMegBox.Show("Đăng Nhập Thành Công");
                    Response.Redirect("~/Admin/XemThongTin.aspx");
                   
                }
                
            }
            catch (Exception ex)
            {
                //throw;
                WebMegBox.Show(ex.Message.ToString());
            }
        }

        protected void btnHuyBo_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/TrangChu.aspx");
        }
    }
}